//
//  DYPushCenter.h
//  singlePushDemo
//
//  Created by JM on 15/10/10.
//  Copyright © 2015年 JM. All rights reserved.
//


#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#import "GeTuiSdk.h"
#import "Singletion.h"
#import "DYSMSCenter.h"

#define DYPushCenterLogSwith 0


//消息通知类型  发送者_内容_To接收者
static NSString *DYPushCenter_Message = @"DYPushCenter_Message";


//注册推送服务器的3个参数
// production - 用来测试推送模块是否有bug采用的参数，使用JM的账号注册的后台 账号 密码见reademe文件
//#define kAppId           @"WPylDZNmXWAC6Lqf49qh96" //WPylDZNmXWAC6Lqf49qh96
//#define kAppKey          @"RqSJE5oPnG9W2uMybCDbS3"  //RqSJE5oPnG9W2uMybCDbS3
//#define kAppSecret       @"PdMXEjEWV1AmFDfZijuRG3"  //PdMXEjEWV1AmFDfZijuRG3

// production - 杭州第三方云平台使用的参数
#define kAppId           @"0oyQ5GPHT695GpQIoSxGr"
#define kAppKey          @"HeInJlkvsj5u5lsatQ4bj3"
#define kAppSecret       @"jfFbSvvL7p9y4agKa5yQG5"

typedef void(^HandleRegisterBlock)(NSString *clientID, NSError *error);
typedef void(^HandleOpenOrCloseBlock)(BOOL isOff, NSError *error);

@interface DYPushCenter : NSObject
singleton_interface(DYPushCenter)

@property(nonatomic,retain) NSString *clientId;//客户端唯一标示

/**
 *  1注册
 *  2流程 ：注册apns得到token－》利用token注册个推center得到clientID
 *
 *  @param block 注册结果处理，成功返回client,失败返回error
 */
- (void)registerPushCenterWithHandleBlock:(HandleRegisterBlock)block;

/**
 *  添加移除 推送消息的接收者
 *
 *  消息 种类aSMSType：@"DYPushCenter_Message" 消息类型message:NSStrirng
 */

- (void) addMessagePushReceiver:(id<DYSMSProtocol>) aRecerver;
- (void) removeMessagePushReceiver:(id<DYSMSProtocol>) aRecerver;

//暂时需要从appdelegate乔接
+ (void)application:(UIApplication*)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData*)deviceToken;
+ (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error;
+ (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions;
+ (void)applicationDidBecomeActive:(UIApplication *)application;
+ (void)applicationDidEnterBackground:(UIApplication *)application;
@end

